<?php
define('_file_','view_topic');
if ( !isGod() )
	if ( !getRights($mod,'full') )
		if ( !News_getAccessFile(_file_) )
		{
			showMsg('Không có quyền truy cập vào trang này này !','ex','center');
			die();
		}
$cid = (!get_magic_quotes_gpc()) ? addslashes(@$_GET['cid']) : intval(@$_GET['cid']);
if ( empty($cid) || $cid <= 0 )
	die('Dữ liệu không hợp lệ !');

$sql = "select * from category where cid=$cid";
$rs = $link->execute($sql);
$cname = $rs->fields('cname');
$sql = "SELECT * FROM topic WHERE cid=$cid ORDER BY position, orderby desc";
$rs = $link->execute($sql);

echo '<br>
<br>
<br>
<table cellpadding="0" cellspacing="0" border="0" width="98%" align="center">';

echo '<tr>';
echo '<td height="23" bgcolor="#6699CC" class="clsTitle">&nbsp;<img src="images/list.gif" border="0" align="absmiddle">&nbsp;Danh mục chủ đề [<font color="#FFFF00">' . $cname . '</font>]</td>';
echo '<td bgcolor="#6699CC" align="right"><a href="admin.php?mod=News&act=add_topic&cid=' . $cid . '" style="text-decoration: none; color: #FFFF00; font-weight: bold"><img src="images/add.gif" border="0" align="absmiddle" alt="Thêm chủ đề mới">&nbsp;Thêm chủ đề mới&nbsp;</a></td>';
echo '</tr>';

echo '<tr><td colspan="2">';

echo '<table cellpadding="0" cellspacing="1" border="0" width="100%" align="center" style="border: 1px solid #CCCCCC">';
echo '<tr>';
echo '<td height="23" class="clsBold" bgcolor="#AAAAAA" align="center">Tên chủ đề (Vietnamese)</td>';
echo '<td class="clsBold" bgcolor="#AAAAAA" align="center">Tên chủ đề (English)</td>';
echo '<td class="clsBold" bgcolor="#AAAAAA" width="60" align="center">Thứ tự</td>';
echo '<td class="clsBold" bgcolor="#AAAAAA" align="center" colspan="4">Thao tác</td>';
echo '</tr>';

$stt = 0;
while ( !$rs->EOF )
{
	if ( $stt++ % 2 == 0 )	$clr = "#FFFFCC";
	else	$clr = "#F0F0F0";
	
	echo '<tr>';
	echo '<td bgcolor="' . $clr . '">&nbsp;' . $rs->fields('tname_vn') . '</td>';
	echo '<td bgcolor="' . $clr . '">&nbsp;' . $rs->fields('tname_en') . '</td>';
	
	echo '<td bgcolor="' . $clr . '" align="center">&nbsp;' . $rs->fields('orderby') . '</td>';

	echo '<td align="center" bgcolor="' . $clr . '"><a href="admin.php?mod=' . $mod . '&act=list_article&tid=' . $rs->fields('tid') . '&cid=' . $cid . '"><img src="images/list.gif" border="0" align="absmiddle" alt="Danh sách các tin của chủ đề"></a></td>';	
	echo '<td align="center" bgcolor="' . $clr . '"><a href="admin.php?mod=' . $mod . '&act=add_article&tid=' . $rs->fields('tid') . '&cid=' . $cid . '"><img src="images/add_trans.gif" border="0" align="absmiddle" alt="Thêm tin vào chủ đề này"></a></td>';
	echo '<td align="center" bgcolor="' . $clr . '"><a href="admin.php?mod=' . $mod . '&act=edit_topic&tid=' . $rs->fields('tid') . '&cid=' . $cid . '"><img src="images/edit_trans.gif" border="0" align="absmiddle" alt="Hiệu chỉnh chủ đề"></a></td>';
	echo '<td align="center" bgcolor="' . $clr . '"><a href="#" onClick="__this__confirm__del(\'admin.php?mod=' . $mod . '&act=delete_topic&tid=' . $rs->fields('tid') . '&cid=' . $cid . '\')"><img src="images/delete_trans.gif" border="0" align="absmiddle" alt="Xóa chủ đề"></a></td>';
	echo '</tr>';
	
	$rs->movenext();
}

echo '</table>';
echo '</td></tr>';
echo '</table>';

?>
<script language="javascript">
function __this__confirm__del(_url_redir_)
{
	if ( confirm('Ban co chac la muon xoa khong ?') )
		self.location = _url_redir_;
}
</script>